<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

	<!--添加需要搜索的工具  -->
	<div id="huotb13" style="padding: 13px; height: auto">
		<div>
			<a id="huoadd13" href="javascript:void(0)" class="easyui-linkbutton"
				data-options="iconCls:'icon-add',plain:true">添加</a> 
			<a id="huoedit13" href="javascript:void(0)" class="easyui-linkbutton"
				data-options="iconCls:'icon-edit',plain:true" >编辑</a>	
			<a href="javascript:void(0)" class="easyui-linkbutton"
				data-options="iconCls:'icon-remove',plain:true" onclick="removeit()">删除</a>
			<sapn style="margin-left:50%">搜索文本：</sapn>
			<input class="easyui-numberbox easyui-searchbox"
				data-options="searcher:searchname,prompt:'请输入需要搜索的规则名称'"
				style="width: 23%">
		</div>
	</div>
	
	<table id="huodg13" class="easyui-datagrid" ></table>
	<div id="huodd13" class="easyui-datagrid" style="width: 600px; height: 400px"
		data-options="modal:true,closed:true,title:'修改申请'">
			<form id="ff" method="post" action="addemp">
				<div id="holidaybody" style="margin:2% 2%">
			     <input class="easyui-textbox " type="hidden" style="display:none" id="ruleId"/><br>
			     <input class="easyui-textbox " type="hidden" style="display:none" id="maker"/><br>
			     <input class="easyui-textbox " type="hidden" style="display:none" id="makeTime"/><br>
				 <label>考勤规则名称:</label> 
				 <input  id="computeId" class="easyui-combobox  holidaytext"/><br>
				 <label style="margin:2% 0">上班打卡时间:</label> 
				 <input  id="inbeginTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input>
				 <label style="margin:2% 0">结束时间:</label> 
				 <input  id="inendTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input></br>
				 <label>迟到打卡时间:</label> 
				 <input id="latebeginTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input>
				 <label >结束时间:</label> 
				 <input id="lateendTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input></br>
				 <label style="margin:2% 0">早退打卡时间:</label> 
				 <input id="earlybeginTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input>
				 <label>结束时间:</label> 
				 <input id="earlyendTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input></br>
				 <label style="margin:2% 0">下班打卡时间:</label> 
				 <input id="outbeginTime"class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input>
				 <label>结束时间:</label> 
				 <input id="outendTime" class="easyui-timespinner holidaytext" data-options="min:'00:00',max:'24:00',showSeconds:true"></input></br>
				<label for="dname">备<sapn style="margin-left:9%"></sapn>注:</label>
				<textarea rows="10" cols="30" class=" holidaytext" id="remark" style="height:50px"></textarea>
			</div>
			</form>
	</div>
	   <script src="../hyn/js/check/checkRule.js"></script>
		<script type="text/javascript">
		$("#huoadd13").bind('click',function() {
			addTab("添加考勤规则","../rule/toCheckRule");
	     })
	     $('#computeId').combobox({});
	     $('#inbeginTime').timespinner({});
		$('#inendTime').timespinner({});
		$('#inbeginTime').timespinner({});
		$('#latebeginTime').timespinner({});
		$('#lateendTime').timespinner({});
		$('#earlybeginTime').timespinner({});
		$('#earlyendTime').timespinner({});
		$('#outbeginTime').timespinner({});
		$('#outendTime').timespinner({});
		// 定义底部保存，清空，取消按钮
		$('#huodd13').dialog({
			buttons : [ {
				text : '保存',
				iconCls : 'icon-save',
				handler : function() {
					$('#ff').form('submit', {
						onSubmit : function(param) {
						var ruleId= $("#ruleId").val();
						var	computeId=$("#computeId").val();
						var clockIn='上班';
						var	inbeginTime=$("#inbeginTime").timespinner('getValue');
						var	inendTime=$("#inendTime").timespinner('getValue'); 
						var clockLate='迟到';	
						var	latebeginTime=$("#latebeginTime").timespinner('getValue'); 
						var	lateendTime=$("#lateendTime").timespinner('getValue'); 
						var earlyClock='早退';
						var	earlybeginTime=$("#earlybeginTime").timespinner('getValue'); 
						var	earlyendTime=$("#earlyendTime").timespinner('getValue'); 
						var clockOut='下班';
						var	outbeginTime=$("#outbeginTime").timespinner('getValue'); 
						var	outendTime=$("#outendTime").timespinner('getValue'); 
						var	remark=$("#remark").timespinner('getValue'); 
						var	maker=$("#maker").val(); 
						var	makeTime=$("#makeTime").val(); 
							var rules = [];
							var rule = {
									ruleId : ruleId,
									computeId : computeId,
									clockIn:clockIn,
									inbeginTime : inbeginTime,
									inendTime : inendTime,
									clockLate:clockLate,
									latebeginTime : latebeginTime,
									lateendTime : lateendTime,
									earlyClock:earlyClock,
									earlybeginTime:earlybeginTime,
									earlyendTime:earlyendTime,
									clockOut:clockOut,
									outbeginTime:outbeginTime,
									outendTime:outendTime,
									remark:remark,
									maker:maker,
									makeTime:makeTime
								};
							    rules.push(rule);
								var jsondata = JSON.stringify(rules);
							$.ajax({
								url : "../rule/updateCheckRule",
								data : {"jsondata" : jsondata},
								success : function(e) {
									if (e == "ok") {
										alert("修改成功");
						               $('#huodg13').datagrid('load');
									}
								}
							});
						}
					});
				}
			}, {
				text : '清空',
				iconCls : 'icon-clear',
				handler : function() {
					$('#ff').form('clear');
				}
			}, {
				text : '取消',
				iconCls : 'icon-cancel',
				handler : function() {
					$("#huodd13").window("close");
				}
			} ]
		});
		</script>
</body>
</html>